<?php
namespace haibao\cms\business\control\wap\common;

class CommentController extends \haibao\cms\business\control\Base{

	public function __construct($updateTime = null,$controlId,$isPublish){
		parent::__construct($updateTime,$controlId,$isPublish);
	}
	
	public function displayTemplateHtml(){
		$controlData = $this->getParameter(self::$CONTROL_DATA);
		$content = $this->getParameter(self::$CONTROL_CONTENT);
		
		$id = '';
		$type = '';
		if($controlData['manual']){
			$type = $controlData['manual']['type'];
			$id = $controlData['manual']['articleId'];
		}
		
		if ($type == 1){
			//文章
			$type = 22;
		}else{
			//图集
			$type = 1235;
		}

		$path = $this->generateHtmlPath(__CLASS__,$id);
		$this->assign('type',$type);
		$this->assign('id',$id);
		$this->assign('gonzo',$this->getcommentgonzo($type, $id));
		$this->generateHtml($path,$content);
		
		//$html = $this->getHtml($path);
		//var_dump($html);
		//exit;
		
		return  $this->getHtml($path);
	}
	
	private function getcommentgonzo($content_type_id,$object_id)
	{
		//旧有用的wqy 2014/1/3
		$secret='j2(4b05c_4((o+0penbd5x6w^2*lx3ol)pk!my#vzr+&964ln1';
		return md5("$content_type_id:$object_id".$secret);
	}
}